/*
 * alesmana
 */

package databeans;

import helper.Formatter;


import java.util.Date;



//add comparable
public class Transaction {

    public static final String BUY_ORDER = "buyOrder";
    public static final String SELL_ORDER = "sellOrder";
    public static final String EXCHANGE_SELL_ORDER = "exchangeSellOrder";
    public static final String EXCHANGE_BUY_ORDER = "exchangeBuyOrder";
    public static final String CHECK_REQUEST = "checkRequest";
    public static final String CHECK_DEPOSIT = "checkDeposit";
    
    private int transactionID = -1;
    private int customerID = -1;
    private int fundID = -1;
    private Date executeDate = null; //store date of when customer submit the order? assume submission date = execution date
    private Date submissionDate = null;
    private long shares = 0000;
    private String transactionType = null;
    private long amount = 0000;
    private int correspondingTransactionID = -1;
    private boolean isSuccess = false;

    public Transaction() {
        transactionID = -1;
        customerID = -1;
        fundID = -1;
        submissionDate = null;
        executeDate = null; //store date of when customer submit the order? assume submission date = execution date
        shares = 0;
        transactionType = null;
        amount = 000;
        isSuccess = false;
        correspondingTransactionID = -1;
    }
    
    public Transaction(int transID, int customerID, int fundID, Date eDate, Date sDate, long shares, String transType, long amount, int corresID, int isSuccessInt) {
        this.transactionID = transID;
        this.customerID = customerID;
        this.fundID = fundID;
        this.submissionDate = sDate;
        this.executeDate = eDate;
        this.shares = shares;
        this.transactionType = transType;
        this.amount = amount;
        boolean isSuccess=false;
        if (isSuccessInt==1) {
        	isSuccess = true;
        } else {
        	isSuccess = false;
        }
        this.isSuccess = isSuccess;
        this.correspondingTransactionID = corresID;
    }
    
    public Date getSubmissionDate() {
        return submissionDate;
    }

    public void setSubmissionDate(Date submissionDate) {
        this.submissionDate = submissionDate;
    }

    public int getTransactionID() {
        return transactionID;
    }

    public int getCustomerID() {
        return customerID;
    }

    public int getFundID() {
        return fundID;
    }

    public Date getExecuteDate() {
        return executeDate;
    }

    public long getShares() {
        return shares;
        //return Double.parseDouble(Formatter.sharesDf.format(shares));
    }

    public String getTransactionType() {
        return transactionType;
    }

    public long getAmount() {
        return amount;
        //return Double.parseDouble(Formatter.cashDf.format(amount));
    }

    public boolean isSuccess() {
        return isSuccess;
    }
    
    public int getCorrespondingTransactionID() {
        return correspondingTransactionID;
    }
    
    public void setTransactionID(int transactionID) {
        this.transactionID = transactionID;
    }
    
    public void setCorrespondingTransactionID(int correspondingTransactionID) {
        this.correspondingTransactionID = correspondingTransactionID;
    }

    public void setCustomerID(int customerID) {
        this.customerID = customerID;
    }

    public void setFundID(int fundID) {
        this.fundID = fundID;
    }

    public void setExecuteDate(Date executeDate) {
        this.executeDate = executeDate;
    }

    public void setShares(long shares) {
        //double setShares = Double.parseDouble(Formatter.sharesDf.format(shares));
        this.shares = shares;
    }

    public void setTransactionType(String transactionType) {
        this.transactionType = transactionType;
    }

    public void setAmount(long amount) {
        //double setAmount = Double.parseDouble(Formatter.cashDf.format(amount));
        this.amount = amount;
    }

    public void setSuccess(boolean isSuccess) {
        this.isSuccess = isSuccess;
    }







}
